vim.g.have_nerd_font = true
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.g.copilot_no_tab_map = true
vim.g.copilot_assume_mapped = true
vim.g.nobackup = true
vim.g.nowritebackup = true
vim.g.noswapfile = true
vim.g.mapleader = " "
vim.g.maplocalleader = " "

vim.opt.undofile = true
vim.opt.undolevels = 100
vim.opt.undoreload = 1000

-- Hint: use `:h <option>` to figure out the meaning if needed
vim.opt.clipboard = "unnamed"
vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.mouse = "a" -- allow the mouse to be used in Nvim

-- Tab
vim.opt.tabstop = 4 -- number of visual spaces per TAB
vim.opt.softtabstop = 4 -- number of spacesin tab when editing
vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
vim.opt.expandtab = true -- tabs are spaces, mainly because of python

-- UI config
vim.opt.number = true -- show absolute number
vim.opt.relativenumber = true -- add numbers to each line on the left side
vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
vim.opt.splitbelow = true -- open new vertical split bottom
vim.opt.splitright = true -- open new horizontal splits right
-- vim.opt.termguicolors = true        -- enabl 24-bit RGB color in the TUI
vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint

-- Searching
vim.opt.incsearch = true -- search as characters are entered
vim.opt.hlsearch = true -- do not highlight matches
vim.opt.ignorecase = true -- ignore case in searches by default
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered

vim.opt.numberwidth = 6

local win_height = vim.fn.winheight(0)
vim.opt.scrolloff = math.floor((win_height - 1) / 2)
vim.opt.sidescrolloff = math.floor((win_height - 1) / 2)

vim.opt.signcolumn = "yes"

vim.opt.colorcolumn = "80"

-- Maximum of 16 lines of prompt
-- This affects both neovim's native completion and that of nvim-cmp
vim.opt.pumheight = 16

vim.opt.foldmethod = "indent"
vim.opt.foldlevel = 6

vim.opt.inccommand = "split" -- 实时显示 substitute 命令效果

-- 更好的折行处理
vim.opt.breakindent = true -- 折行保持缩进
vim.opt.showbreak = "↪ " -- 折行显示符号
